<%@ page pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
	<head>
		<title>展示学生信息</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/style.css" />
        <script type="text/javascript">
            window.onload=function(){
                document.querySelector("input[type='button']").onclick=function () {
                    var boxs=document.querySelectorAll("input[type='checkbox']");
                    for (var i=0;i<boxs.length;i++){
                        boxs[i].checked=true;
                    }
                }
            }
        </script>
	</head>
	<body>
		<div id="wrap">
			<div id="top_content">
				<div id="header">
					<div id="rightheader">
						<p>
							2019/10/1
							<br />
						</p>
					</div>
					<div id="topheader">
						<h1 id="title">
							<a href="#">main</a>
						</h1>
					</div>
					<div id="navigation">
					</div>
				</div>
				<div id="content">
					<p id="whereami">
					</p>
					<h1>
						Welcome!
					</h1>
					<form action="${pageContext.request.contextPath }/showAll" method="post">
					    姓名：  <input type="text" name="name" value="${name}"/>
					    年龄:   <input type="text" name="age1" value="${age1}"/>--
								<input type="text" name="age2" value="${age2}"/>
							    <input type="submit" value="搜索"/>
					</form>
					<form method="post" action="${pageContext.request.contextPath }/removeAny">
					<table class="table">
						<tr class="table_header">
						    <td>
							   	<input type="button" value="全选">
							</td>
							<td>
								编号
							</td>
							<td>
								姓名
							</td>
							<td>
								年龄
							</td>
							<td>
								分数
							</td>
							<td>
								班级名称
							</td>
							<td>
								操作
							</td>
						</tr>
						<c:forEach var="ss" items="${students}">
							<tr>
								<td>
								   <input type="checkbox" name="ids" value="${ss.studentId}"/>
								</td>
								<td>
									${ss.studentId}
								</td>
								<td>
									${ss.name}
								</td>
								<td>
									${ss.age}
								</td>
								<td>
									${ss.score}
								</td>
								<td>
									${ss.classes.className}
								</td>
								<td>
									<a href="${pageContext.request.contextPath }/removeOne?student.studentId=${ss.studentId}">删除</a>&nbsp;
									<a href="${pageContext.request.contextPath }/getOne?student.studentId=${ss.studentId}">修改</a>
								</td>
							</tr>
						</c:forEach>
					</table>


						<div>
							<a href="${pageContext.request.contextPath }/showAll?pageNum=1&name=${name}&age1=${age1}&age2=${age2}">
								首页
							</a>
							<c:if test="${pageNum>1}">
								<a href="${pageContext.request.contextPath }/showAll?pageNum=${pageNum-1}&name=${name}&age1=${age1}&age2=${age2}">
									上一页
								</a>
							</c:if>
								当前是第${pageNum}页/总共有${totalPages}页
							<c:if test="${pageNum<totalPages}">
								<a href="${pageContext.request.contextPath }/showAll?pageNum=${pageNum+1}&name=${name}&age1=${age1}&age2=${age2}">
									下一页
								</a>
							</c:if>
							<a href="${pageContext.request.contextPath }/showAll?pageNum=${totalPages}&name=${name}&age1=${age1}&age2=${age2}">尾页</a>
						</div>

					  <input type="submit" value="删除勾选项"/>
					</form>
					<p>
						<a href="${pageContext.request.contextPath }/getClasses" style="display: block">添加新生</a>
					</p>
				</div>
			</div>
			<div id="footer">
				<div id="footer_bg">
				ABC@126.com
				</div>
			</div>
		</div>
	</body>
</html>
